<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<!-- Bootstrap core CSS -->
    <link href="<%=basePath %>admin/css/bootstrap.min.css" rel="stylesheet">
    <link href="<%=basePath %>admin/css/bootstrap-reset.css" rel="stylesheet">
    <!--external css-->
    <link href="<%=basePath %>admin/assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <!-- Custom styles for this template -->
    <link href="<%=basePath %>admin/css/style.css" rel="stylesheet">
    <link href="<%=basePath %>admin/css/style-responsive.css" rel="stylesheet" />

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 tooltipss and media queries -->
    <!--[if lt IE 9]>
      <script src="js/html5shiv.js"></script>
      <script src="js/respond.min.js"></script>
    <![endif]-->
  </head>

  <body>
<jsp:include page="top.jsp"></jsp:include>
  <section id="container" class="">
      <!--header start-->
     
      <!--sidebar end-->
      <!--main content start-->
      <section id="main-content">
          <section class="wrapper">
              <!-- page start-->
              <div class="row">
                  <div class="col-lg-12">
                      <section class="panel">
                          <header class="panel-heading">
                              中奖名单
                          </header>
                          <table class="table table-striped border-top" id="">
                          <thead>
                          <tr>
                              <th style="width:8px;">序号</th>
                              
                              <th class="hidden-phone">名称</th>
                              <th class="hidden-phone">价格</th>
                              <th class="hidden-phone"></th>
                              <td class="center hidden-phone"></td>
                              <th class="hidden-phone">操作</th>
                          </tr>
                          </thead>
                          <tbody id="goodsList">









                          <tr class="odd gradeX">
                              <td>1</td>
                              <td>名字</td>
                              <td class="hidden-phone">229</td>
                              <td class="hidden-phone"></td>
                              <td class="center hidden-phone"></td>
                              <td class="hidden-phone"><a class="btn btn-primary" style="margin-left: -40px;">编辑</a>
                              <button type="button" class="btn btn-success">删除</button></td>
                          </tr>
                          
                          </tbody>
                          </table>
                      </section>
                  </div>
              </div>
              <!-- page end-->
          </section>
      </section>
      <!--main content end-->
  </section>

    <!-- js placed at the end of the document so the pages load faster -->
    
    
    <script type="text/javascript" src="<%=basePath %>admin/assets/data-tables/jquery.dataTables.js"></script>
    <script type="text/javascript" src="<%=basePath %>admin/assets/data-tables/DT_bootstrap.js"></script>


   

    <!--script for this page only-->
    <script src="<%=basePath %>admin/js/dynamic-table.js"></script>


  </body>
</html>
<script>
$(document).ready(function(){
	showAll();
});
	function showAll(){
		debugger;
		
		var l = document.getElementById("goodsList");
		l.innerHTML='';
		var everything =document.getElementById("everything").value;
		$.ajax( {
						url:'<%=basePath%>goods/findAll',
						type:'post',
						data: {
							
						},
						datatype : "json",//"xml", "html", "script", "json", "jsonp", "text".           
						success : function(data) {
							var json=eval('(' + data + ')');
							$.each(json, function (n, item) {
								if(item.name.indexOf(everything)>=0){
									addGift(n,item);
								}
							});
						},
						error : function() {
			                alert("异常！！！");
			                selAllFriend();	
			            }
				});
	}
	function addGift(n,item){
		var val = "<tr class=\"odd gradeX\">"+
        "<td>"+(n+1)+"</td>"+
        "<td>"+item.name+"</td>"+
        "<td class=\"hidden-phone\">"+item.price+"</td>"+
        "<td class=\"hidden-phone\"></td>"+
        "<td class=\"center hidden-phone\"></td>"+
        "<td class=\"hidden-phone\"><a href=\"../../goods/findOneById?id="+item.id+"\" class=\"btn btn-primary\" style=\"margin-left: -40px;\">编辑</a>"+
        "<button type=\"button\" class=\"btn btn-success\">删除</button></td>"+
    "</tr>";

		$("#goodsList").append(val);
	}
	
	
</script>
